export default {
    state: {
        isCollapse: false,//定义折叠左侧菜单栏变量
        tabList: [{
            path: "/",
            name: "home",
            label: "首页",
            icon: "s-home",
            url: "Home/Home",
        }],//定义head菜单栏面包屑变量
    },
    mutations: {
        //顶一个修改状态方法
        collapseMenu(state) {
            state.isCollapse = !state.isCollapse;
        },
        //新增头部标题栏
        addTab(state, tab) {
            if (tab.name !== 'home') {
                let index = state.tabList.findIndex(item => item.name === tab.name);
                if (index === -1) {
                    state.tabList.push(tab);
                }
            }
        },
        removeTag(state, tab) {
            let index = state.tabList.findIndex(item => item.name === tab.name);
            if (index !== -1) {
                state.tabList.splice(index, 1);
            }
        }
    }
}